# # -*- coding: utf-8 -*-
#
# from __future__ import unicode_literals
#
# from django.db import models
# from common.models import Project, Product, Api, FIELD_STATUS_CHOICE
#
# CAST_TYPE_CHOICE = (
#     ('SINGLE_BUSINESS', u'单业务测试'),
#     ('BUSINESS_FLOW', u'业务流测试'),
#     ('STRONG_TEST', u'健壮性测试')
# )
# DATA_SOURCE_MAKE_STAGE = (
#     ('PRE_EXECUTE', u'用例执行准备阶段'),
#     ('EXECUTING', u'用例执行中')
# )
# DATA_SOURCE_MAKE_FROM = (
#     ('VALUE', u'直接赋值'),
#     ('FROM_DB', u'从数据库获取'),
#     ('SYSTEM_FUNCTION', u'调用系统函数'),
#     ('CUSTOM_FUNCTION', u'自定义函数')
# )
# CAST_TEST_STATUS = (
#     ('TODO', '未执行'),
#     ('PASSED', ' 测试通过'),
#     ('FAILED', '测试失败')
# )
# STEP_TYPE_CHOICE = (
#     ('PRE_CONDITION', u'前置条件'),
#     ('TEST_STEP', u'测试步骤')
# )
# CHECK_TYPE_CHOICE = (
#     ('RESP_CODE', u'验证code'),
#     ('RESP_DATA', u'验证响应值内容'),
#     ('DB_DATA', u'在数据库验证结果')
# )
#
#
# class Cases(models.Model):
#     """测试用例"""
#     case_no = models.CharField(verbose_name=u'用例编号', max_length=50)
#     title = models.CharField(verbose_name=u'用例标题', max_length=255)
#     project = models.ForeignKey(Project, verbose_name=u'所属项目', related_name='cases', blank=True)
#     product = models.ForeignKey(Product, verbose_name=u'所属产品', related_name='cases', blank=True)
#     case_type = models.CharField(verbose_name=u'用例类型', choices=CAST_TYPE_CHOICE)
#     status = models.CharField(verbose_name=u'用例状态', choices=FIELD_STATUS_CHOICE)
#     test_status = models.CharField(verbose_name=u'测试状态', choices=CAST_TEST_STATUS)
#     create_time = models.DateTimeField(verbose_name=u'创建时间', auto_now_add=True)
#     update_time = models.DateTimeField(verbose_name=u'更新时间', auto_now=True)
#
#     class Meta:
#         verbose_name = u'测试用例'
#         verbose_name_plural = u'测试用例'
#
#     def __unicode__(self):
#         return u'%s' % (self.title)
#
#
# class DataSource(models.Model):
#     """数据源"""
#     k = models.CharField(verbose_name=u'键', max_length=32)
#     v = models.CharField(verbose_name=u'值', max_length=256)
#     make_from = models.CharField(verbose_name=u'数据来源方式', choices=DATA_SOURCE_MAKE_FROM)
#     make_stage = models.CharField(verbose_name=u'初始化时机', choices=DATA_SOURCE_MAKE_STAGE)
#     status = models.CharField(verbose_name=u'状态', choices=FIELD_STATUS_CHOICE)
#     update_time = models.DateTimeField(verbose_name=u'更新时间', auto_now=True)
#
#     class Meta:
#         verbose_name = u'数据源'
#         verbose_name_plural = u'数据源'
#
#     def __unicode__(self):
#         return u'%s' % (self.k)
#
#
# class Steps(models.Model):
#     """步骤"""
#     case = models.ForeignKey(Cases, verbose_name=u'所属用例', blank=True)
#     data_source = models.ManyToManyField(DataSource, verbose_name=u'相关数据源', related_name='steps')
#     step_type = models.CharField(verbose_name=u'步骤类型', choices=STEP_TYPE_CHOICE)
#     api = models.ForeignKey(Api, verbose_name=u'所属接口', blank=True)
#     description = models.CharField(verbose_name=u'步骤描述', max_length=256)
#     step_index = models.IntegerField(verbose_name=u'步骤顺序')
#     en_alias = models.CharField(verbose_name=u'步骤名称', max_length=32)
#
#     class Meta:
#         verbose_name = u'步骤'
#         verbose_name_plural = u'步骤'
#
#     def __unicode__(self):
#         return u'%s' % (self.en_alias)
#
#
# class ReqArgs(models.Model):
#     """请求参数"""
#     step = models.ForeignKey(Steps, verbose_name=u'所属步骤')
#     args_index = models.IntegerField(verbose_name=u'参数顺序')
#     name = models.CharField(verbose_name=u'参数名', max_length=50)
#     content = models.CharField(verbose_name=u'参数值', max_length=255)
#
#     class Meta:
#         verbose_name = u'请求参数'
#         verbose_name_plural = u'请求参数'
#
#     def __unicode__(self):
#         return u'%s' % (self.name)
#
#
# class Checks(models.Model):
#     """验证点"""
#     step = models.ForeignKey(Steps, verbose_name=u'所属步骤')
#     check_type = models.CharField(verbose_name=u'验证类型', choices=CHECK_TYPE_CHOICE)
#     query_sql = models.CharField(verbose_name=u'查询SQL', max_length=500)
#     check_rule = models.CharField(verbose_name=u'验证规则', max_length=500)
#
#     class Meta:
#         verbose_name = u'验证点'
#         verbose_name_plural = u'验证点'
#
#     def __unicode__(self):
#         return u'%s' % (self.query_sql)
#
#
# class ReqArgs(models.Model):
#     """请求参数"""
#     case = models.ForeignKey(Cases, verbose_name=u'所属用例', related_name='req_args', blank=True)
#     args_index = models.IntegerField(verbose_name=u'序号', blank=True)
#     args_name = models.CharField(verbose_name=u'请求参数名称', blank=True, max_length=50)
#     value = models.CharField(verbose_name=u'参数值', blank=True, max_length=255)
#
#     class Meta:
#         verbose_name = u'请求参数'
#         verbose_name_plural = u'请求参数'
#
#     def __unicode__(self):
#         return u'%s' % (self.args_name)
